/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function List() {
    this.list = new Array();
}

List.prototype.add = function(obj) {
    var index = this.list.length;
    this.list[index] = obj;
}

List.prototype.size = function() {
    return this.list.length;
}

List.prototype.get = function(index) {
    return this.list[index];
}
List.prototype.remove = function(index) {
    this.list.slice(index);
}
function StringBuffer() {
    this.__strings__ = new Array();
}
StringBuffer.prototype.append = function (str) {
    this.__strings__.push(str);
    return this;
}
StringBuffer.prototype.toString = function () {
    return this.__strings__.join("");
}
StringBuffer.prototype.length = function () {
    return this.__strings__.join("").length;
}
function $d(vId) {    
    return document.getElementById(vId);
}
/*function $(vId) {    
    return document.getElementById(vId);
}*/
function JString(v) {
    value = new String();
    value = v;
}
JString.prototype.equals = function(v) {
    if( this.value == v ) {
        return true;
    } else {
        return false;
    }
}
JString.prototype.indexOf = function(searchValue) {
    return this.value.indexOf(searchValue, 0);
}
JString.prototype.indexOf = function(fromIndex, searchValue) {
    return this.value.indexOf(searchValue, fromIndex);
}
JString.prototype.length = function() {
    return length(this.value);
}
JString.prototype.substring = function(fromIndex,toIndex) {
    return this.value.substring(fromIndex, toIndex);
}
JString.prototype.substring = function(fromIndex) {
    return this.value.substring(fromIndex, length(this.value));
}
JString.prototype.startWith = function(v) {
    return ( this.value.substring(0, length(v)) == v ) ? true : false; 
}
JString.prototype.endsWith = function(v) {
    var diff = length(v) - length(this.value);
    return ( this.value.substring(diff, length(this.value)) == v ) ? true : false; 
}
JString.prototype.valueOf = function() {
    return this.value; 
}
function VTable() {
    key = null;
    value = null;
}
function Hashtable() {
    this.tables = new List();
}
Hashtable.prototype.get = function(key) {
    var i = 0; 
    for(i =0;i < this.tables.size(); i++) {
        //alert("hhh "+ this.tables.get(i).key);
        
        if( this.tables.get(i).key == key ) {
            //alert("hhh pass");
            return this.tables.get(i).value;
        }
    }
    return null;
}
Hashtable.prototype.contrainKey = function(key) {
    var i = 0; 
    for(i =0;i < this.tables.size(); i++) {
        //alert("hhh "+ this.tables.get(i).key);
        
        if( this.tables.get(i).key == key ) {
            //alert("hhh pass");
            return true;
        }
    }
    return false;
}
Hashtable.prototype.indexOf = function(key) {
    var i = 0; 
    for(i =0;i < this.tables.size(); i++) {
        if( this.tables.get(i).key == key ) {
            return i;
        }
    }
    return -1;
}
Hashtable.prototype.put = function(key,value) {
    if( this.contrainKey(key) == true ) {
        var index = this.indexOf(key);
        this.tables.get(index).value = value;
    } else {
        var val = new VTable();
        val.key = key;
        val.value = value;
        this.tables.add(val);
    }
}

function DateUtil() {
    this.dateUtil = new Date();
}
DateUtil.prototype.nowString = function() {
    var du = new Date();
    var s = du.getUTCFullYear() + "-" + format2NBook((du.getUTCMonth()+1))+ "-" + format2NBook(du.getUTCDate()) + " "+format2NBook(du.getHours()) +":"+ format2NBook(du.getMinutes()) +":"+ format2NBook(du.getSeconds()); 
    return s;
}
DateUtil.prototype.nowStringDateOnly = function() {
    var du = new Date();
    var s = du.getUTCFullYear() + "-" + format2NBook((du.getUTCMonth()+1))+ "-" + format2NBook(du.getUTCDate()) + ""; 
    return s;
}